home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.AWTEvent;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.LayoutManager;
- import java.awt.event.InputEvent;
- import java.awt.event.KeyEvent;
- import java.awt.event.WindowEvent;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
-
- public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer {
- private int defaultCloseOperation = 1;
- protected JRootPane rootPane;
- protected boolean rootPaneCheckingEnabled = false;
- protected AccessibleContext accessibleContext = null;
-
- public JFrame() {
- this.frameInit();
- }
-
- public JFrame(String var1) {
- super(var1);
- this.frameInit();
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- if (this.isRootPaneCheckingEnabled()) {
- throw this.createRootPaneException("add");
- } else {
- super.addImpl(var1, var2, var3);
- }
- }
-
- protected JRootPane createRootPane() {
- return new JRootPane();
- }
-
- private Error createRootPaneException(String var1) {
- String var2 = this.getClass().getName();
- return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
- }
-
- protected void frameInit() {
- ((Component)this).enableEvents(72L);
- this.setRootPane(this.createRootPane());
- ((Component)this).setBackground(UIManager.getColor("control"));
- this.setRootPaneCheckingEnabled(true);
- }
-
- public AccessibleContext getAccessibleContext() {
- if (this.accessibleContext == null) {
- this.accessibleContext = new AccessibleJFrame(this);
- }
-
- return this.accessibleContext;
- }
-
- public Container getContentPane() {
- return this.getRootPane().getContentPane();
- }
-
- public int getDefaultCloseOperation() {
- return this.defaultCloseOperation;
- }
-
- public Component getGlassPane() {
- return this.getRootPane().getGlassPane();
- }
-
- public JMenuBar getJMenuBar() {
- return this.getRootPane().getMenuBar();
- }
-
- public JLayeredPane getLayeredPane() {
- return this.getRootPane().getLayeredPane();
- }
-
- public JRootPane getRootPane() {
- return this.rootPane;
- }
-
- protected boolean isRootPaneCheckingEnabled() {
- return this.rootPaneCheckingEnabled;
- }
-
- protected String paramString() {
- String var1;
- if (this.defaultCloseOperation == 1) {
- var1 = "HIDE_ON_CLOSE";
- } else if (this.defaultCloseOperation == 2) {
- var1 = "DISPOSE_ON_CLOSE";
- } else if (this.defaultCloseOperation == 0) {
- var1 = "DO_NOTHING_ON_CLOSE";
- } else if (this.defaultCloseOperation == 3) {
- var1 = "EXIT_ON_CLOSE";
- } else {
- var1 = "";
- }
-
- String var2 = this.rootPane != null ? this.rootPane.toString() : "";
- String var3 = this.rootPaneCheckingEnabled ? "true" : "false";
- return super.paramString() + ",defaultCloseOperation=" + var1 + ",rootPane=" + var2 + ",rootPaneCheckingEnabled=" + var3;
- }
-
- protected void processKeyEvent(KeyEvent var1) {
- super.processKeyEvent(var1);
- if (!((InputEvent)var1).isConsumed()) {
- JComponent.processKeyBindingsForAllComponents(var1, this, ((AWTEvent)var1).getID() == 401);
- }
-
- }
-
- protected void processWindowEvent(WindowEvent var1) {
- super.processWindowEvent(var1);
- if (((AWTEvent)var1).getID() == 201) {
- switch (this.defaultCloseOperation) {
- case 0:
- default:
- break;
- case 1:
- ((Component)this).setVisible(false);
- break;
- case 2:
- ((Component)this).setVisible(false);
- ((Frame)this).dispose();
- break;
- case 3:
- System.exit(0);
- }
- }
-
- }
-
- public void remove(Component var1) {
- if (var1 == this.rootPane) {
- super.remove(var1);
- } else {
- this.getContentPane().remove(var1);
- }
-
- }
-
- public void setContentPane(Container var1) {
- this.getRootPane().setContentPane(var1);
- }
-
- public void setDefaultCloseOperation(int var1) {
- this.defaultCloseOperation = var1;
- }
-
- public void setGlassPane(Component var1) {
- this.getRootPane().setGlassPane(var1);
- }
-
- public void setJMenuBar(JMenuBar var1) {
- this.getRootPane().setMenuBar(var1);
- }
-
- public void setLayeredPane(JLayeredPane var1) {
- this.getRootPane().setLayeredPane(var1);
- }
-
- public void setLayout(LayoutManager var1) {
- if (this.isRootPaneCheckingEnabled()) {
- throw this.createRootPaneException("setLayout");
- } else {
- super.setLayout(var1);
- }
- }
-
- protected void setRootPane(JRootPane var1) {
- if (this.rootPane != null) {
- this.remove(this.rootPane);
- }
-
- this.rootPane = var1;
- if (this.rootPane != null) {
- boolean var2 = this.isRootPaneCheckingEnabled();
-
- try {
- this.setRootPaneCheckingEnabled(false);
- ((Container)this).add(this.rootPane, "Center");
- } finally {
- this.setRootPaneCheckingEnabled(var2);
- }
- }
-
- }
-
- protected void setRootPaneCheckingEnabled(boolean var1) {
- this.rootPaneCheckingEnabled = var1;
- }
-
- public void update(Graphics var1) {
- ((Container)this).paint(var1);
- }
- }
-